package org.labo.sigmalivepaper;

import nsidc.spheres.Point;
import nsidc.spheres.SphericalPolygon;

public class BatimentEnum {

	public enum GPS {
		
		BAT_1(  new Double[]{47.2623390, -1.5480950},
				new Double[]{47.2622090, -1.5481080},
				new Double[]{47.2621590, -1.5481130},
				new Double[]{47.2621580, -1.5481060},
				new Double[]{47.2621030, -1.5481110},
				new Double[]{47.2620790, -1.5481510},
				new Double[]{47.2619940, -1.5481550},
				new Double[]{47.2619910, -1.5480360},
				new Double[]{47.2620290, -1.5479710},
				new Double[]{47.2620180, -1.5479560},
				new Double[]{47.2620120, -1.5479100},
				new Double[]{47.2619950, -1.5475290},
				new Double[]{47.2620930, -1.5475190},
				new Double[]{47.2621000, -1.5476700},
				new Double[]{47.2621430, -1.5476650},
				new Double[]{47.2621410, -1.5476150},
				new Double[]{47.2623130, -1.5475980},
				new Double[]{47.2623160, -1.5476470},
				new Double[]{47.2623540, -1.5476430},
				new Double[]{47.2623620, -1.5478080},
				new Double[]{47.2623260, -1.5478110}),
		
		BAT_2345(  new Double[]{47.2611470, -1.5497060},
				new Double[]{47.2610780, -1.5496160},
				new Double[]{47.2611950, -1.5494160},
				new Double[]{47.2611160, -1.5493160},
				new Double[]{47.2609310, -1.5494130},
				new Double[]{47.2610250, -1.5492580},
				new Double[]{47.2609600, -1.5491700},
				new Double[]{47.2608630, -1.5493220},
				new Double[]{47.2607420, -1.5491600},
				new Double[]{47.2608560, -1.5489740},
				new Double[]{47.2609790, -1.5491350},
				new Double[]{47.2611150, -1.5489140},
				new Double[]{47.2611840, -1.5490010},
				new Double[]{47.2610750, -1.5491880},
				new Double[]{47.2611390, -1.5492750},
				new Double[]{47.2612110, -1.5491660},
				new Double[]{47.2611890, -1.5491350},
				new Double[]{47.2612340, -1.5490640},
				new Double[]{47.2613160, -1.5491740},
				new Double[]{47.2613120, -1.5491930},
				new Double[]{47.2613230, -1.5492120},
				new Double[]{47.2613330, -1.5492000},
				new Double[]{47.2614030, -1.5492930},
				new Double[]{47.2613450, -1.5493920},
				new Double[]{47.2613730, -1.5494360},
				new Double[]{47.2612820, -1.5495820},
				new Double[]{47.2612480, -1.5495430},
				new Double[]{47.2611470, -1.5497060}),
						
		BAT_6(  new Double[]{47.2604590, -1.5487100},
				new Double[]{47.2603610, -1.5485060},
				new Double[]{47.2604970, -1.5483670},
				new Double[]{47.2605940, -1.5485670}),
		
		BAT_7( 	new Double[]{47.2606170,-1.5489100},
				new Double[]{47.2605630,-1.5487960},
				new Double[]{47.2607000,-1.5486550},
				new Double[]{47.2607550,-1.5487710},
				new Double[]{47.2607980,-1.5488620},
				new Double[]{47.2606610,-1.5490030}),
		
		BAT_8(  new Double[]{ 47.2609680,-1.5485290},
				new Double[]{47.2609260,-1.5484330},
				new Double[]{47.2611890,-1.5481830},
				new Double[]{47.2612230,-1.5482620},
				new Double[]{47.2612180,-1.5482920},
				new Double[]{47.2612110,-1.5483290},
				new Double[]{47.2609800,-1.5485550});
		
		private Double[][] points;
		private SphericalPolygon sphericalPolygon;
		
		private GPS(Double[] ... points) {
			this.points = points;
			
			Point[] pts = new Point[points.length]; 
			for (int i = 0; i < points.length; i++) {
				Double[] point = points[i];
				pts[i] = new Point(point[0], point[1]);
			}
			
			this.sphericalPolygon = new SphericalPolygon(pts);
		}
		
		public Double[][] points() {
			return points;
		}
		
		public SphericalPolygon sphericalPolygon() {
			return sphericalPolygon;
		}
		
		public boolean contains(Double lat, Double lon) {
			return sphericalPolygon.contains(new Point(lat,lon));
		}
		
	}
	
}
